package org.cug.uav.gcs.map;

import org.eclipse.swt.graphics.Point;

import com.sun.xml.internal.bind.v2.model.core.Ref;

public class Location {
	public Double latitude;
	public Double longitude;
	public Integer pixelX;
	public Integer pixelY;
	public int levelOfDetail;
	
	public Location(int _pixelX,int _pixelY,int _levelOfDetail){
		pixelX=_pixelX;
		pixelY=_pixelY;
		levelOfDetail=_levelOfDetail;
		TileHelper.PixelXYToLatLong(pixelX, pixelY, _levelOfDetail, this);
	}
	
	Location(double _latitude,double _longitude,int _levelOfDetail){
		latitude=_latitude;
		longitude=_longitude;
		//levelOfDetail=_levelOfDetail;
		Point pixelPoint=new Point(0, 0);
		TileHelper.LatLongToPixelXY(latitude, longitude, _levelOfDetail, pixelPoint);
		pixelX=pixelPoint.x;
		pixelY=pixelPoint.y;
	}
	
	public void move(Point p)
	{
		pixelX-=p.x;
		pixelY-=p.y;
		TileHelper.PixelXYToLatLong(pixelX, pixelY, levelOfDetail, this);
	}
	
	public void scoll(Point p)
	{
		pixelX+=p.x;
		pixelY+=p.y;
		TileHelper.PixelXYToLatLong(pixelX, pixelY, levelOfDetail, this);
	}
}
